<?php

namespace app\qsapi\controller;


use app\qsapi\model\BaseModel;
use app\qsapi\model\BoxGameCate;
use app\qsapi\service\BoxAdService;
use app\qsapi\service\GameService;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
use think\exception\DbException;
use think\response\Json;


/**
 * 游戏模块
 */
class Game extends BaseController
{
    protected $noNeedLogin=['cateList','list','info'];

    /**
     * 游戏分类
     * @return Json
     */
    public  function  cateList(): Json
    {
        $gameService= new GameService();
        return  json($gameService->cateList());
    }
    /**
     * 游戏列表
     * @return Json
     */
    public  function list(): Json
    {
        $gameService= new GameService();
        return  json($gameService->getList());
    }

    /**
     * 游戏详情
     * @return Json
     * @throws DataNotFoundException
     * @throws DbException
     * @throws ModelNotFoundException
     */
    public function info(): Json
    {
        $id=request()->get('id',0);
        $gameService= new GameService();
        return  json($gameService->getInfo($id));

    }





}
